﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace TimbreRecognition.Forms
{
    public partial class ChartForm : Form
    {
        private const int DefaultSeriesIndex = 0;

        public int LineWidth 
        { 
            get
            {
                return this.chart.Series[DefaultSeriesIndex].BorderWidth;
            }
            set 
            {
                this.chart.Series[DefaultSeriesIndex].BorderWidth = value;
            } 
        }

        public ChartForm()
        {
            InitializeComponent();
            this.chart.Series[DefaultSeriesIndex].ChartType = SeriesChartType.FastLine;
        }

        public ChartForm(double[] values, double[] arguments) : this()
        {
            if (values.Length != arguments.Length)
            {
                throw new ArgumentException("Arrays must be of equal size");
            }

            for (int i = 0; i < values.Length; i++)
            {
                this.chart.Series[0].Points.AddXY(arguments[i], values[i]);
            }
        }

        public ChartForm(double[] data) : this()
        {
            for (int i = 0; i < data.Length; i++)
            {
                this.chart.Series[0].Points.AddXY(i + 1, data[i]);
            }
        }
    }
}
